/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utilities.entities;

import java.util.ArrayList;
import javax.swing.table.DefaultTableModel;
import utilities.ResultFixture;

/**
 *
 * @author olawale
 */
public class SelectionList {

    public SelectionList(ArrayList<Selection> selections, boolean only){
        this.selections = selections;
        this.only = only;


    }

    private ArrayList<Selection> selections;
    private ArrayList<Selection> selected;
    private boolean only;

    public ArrayList<Selection> getSelections() {
        return selections;
    }

    public void setSelections(ArrayList<Selection> selections) {
        this.selections = selections;
    }

    public boolean isOnly() {
        return only;
    }

    public void setOnly(boolean only) {
        this.only = only;
    }

    public ArrayList<Selection> getSelected() {
        selected = new ArrayList();
        for(Selection sel : selections){
            if(sel.isSelected())
                selected.add(sel);
        }
        return selected;
    }

    public void setSelected(ArrayList<Selection> selected) {
        this.selected = selected;
    }

    public static ArrayList<Selection> getDefault(boolean sel){
        DefaultTableModel dtm = new DefaultTableModel();
        dtm.setRowCount(1);
        ResultFixture rf = new ResultFixture(null, dtm, 0);
        ArrayList<RatedColumn> columns = rf.getColumns();
        ArrayList<Selection> sels = new ArrayList();

        for(RatedColumn rc : columns){
            sels.add(new Selection(rc, sel, null));
        }

        return sels;
    }

}
